/**
 * 
 */
package model;

import java.util.ArrayList;

import common.GridCoordinate;

/**
 * @author Bill
 * 
 * A type of Tile which DefensiveItems can be placed on but 
 * AutomaticWeapons cannot. TrailTiles are what the zombosaurs
 * travel on towards the spaceship.
 *
 */
public class TrailTile extends Tile {
	
	private ArrayList<Zombosaur> zombosaursOnTile = new ArrayList<Zombosaur>();
	private ArrayList<Zombosaur> approachingZombosaurs = new ArrayList<Zombosaur>();
	
	public TrailTile(GridCoordinate coord) {
		super(coord);
	}
	
	public TrailTile(int xCoord, int yCoord){
		this(new GridCoordinate(xCoord,yCoord));
	}
	
	public boolean tileHasZombosaur(){
		if(zombosaursOnTile.size() > 0) return true;
		return false;
	}
	
	public void zombosaurEnteredTile(Zombosaur zombo){
		approachingZombosaurs.remove(zombo);
		zombosaursOnTile.add(zombo);
		zombo.setCurrentTile(this);
	}
	
	public void zombosaurExitedTile(Zombosaur zombo){
		zombosaursOnTile.remove(zombo);
	}
	
	public ArrayList<Zombosaur> getZombosaursOnTile() {
		return zombosaursOnTile;
	}
	
	public void zombosaurApproaching(Zombosaur zombo ){
		approachingZombosaurs.add(zombo);
	}
	
	public boolean tileHasApproachingZombosaur(){
		if(approachingZombosaurs.size() > 0){
			return true;
		}
		return false;
	}
	public void removeApproachingZombosaur(Zombosaur zombo){
		if(tileHasApproachingZombosaur()){
			approachingZombosaurs.remove(zombo);
		}
	}
}
